package com.jic.veteran.controller;

import com.jic.veteran.common.api.CommonPage;
import com.jic.veteran.common.api.CommonResult;
import com.jic.veteran.model.ReconResult;
import com.jic.veteran.service.ReconResultService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Api(tags = "ReconResultController")
@Controller
@RequestMapping("/reconResult")
public class ReconResultController {

    @Autowired
    ReconResultService reconResultService;

    @ApiOperation("查询对账结果列表")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<CommonPage<ReconResult>> list(@RequestParam(value = "reconDate",required = false) String reconDate,
                                                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        List<ReconResult> reconResultList = reconResultService.getReconResults(reconDate,pageSize,pageNum);
        return CommonResult.success(CommonPage.restPage(reconResultList));
    }
}
